// Programming_Scala/src/ch09/actor-mailbox-script.scala
import scala.actors.Actor
import scala.actors.Actor._

val countActor = actor {
  loop {
    react {
      case "how many?" => {
        println( "I've got " + mailboxSize + " messages in my mailbox." )
      }
    }
  }
}

countActor ! "how many?"
countActor ! 1
countActor ! 2
countActor ! 3
countActor ! "how many?"
countActor ! "how many?"
countActor ! 4
countActor ! "how many?"
